import java.awt.geom.FlatteningPathIterator;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

        int[][] points = new int[n][2];

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < 2; j++) {
                points[i][j] = scanner.nextInt();
            }
        }

        Solution2 solution2 = new Solution2();
        System.out.println(solution2.numberOfPairs(points));
    }

    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        int z = scanner.nextInt();

        Solution1 solution1 = new Solution1();

        System.out.println(solution1.findClosest(x,y,z));
    }
}

class Solution1 {
    public int findClosest(int x, int y, int z) {
        if(Math.abs(x-z)>Math.abs(y-z)){
            return 2;
        }else if(Math.abs(x-z)<Math.abs(y-z)){
            return 1;
        }else{
            return 0;
        }
    }
}

class Solution2 {
    public int numberOfPairs(int[][] points) {
        int n = points.length;
        int res = 0;

        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                int x1 = points[i][0];
                int y1 = points[i][1];
                int x2 = points[j][0];
                int y2 = points[j][1];
                if((x1 - x2 <= 0 && y1 - y2 >= 0 )||(x2 - x1 <= 0 && y2 - y1 >= 0)){
                    boolean flag = true;
                    if(x1 >= x2 && y1<= y2){
                        int t = x1;
                        x1 = x2;
                        x2 = t;
                        t = y1;
                        y1 = y2;
                        y2 = t;
                    }
                    for (int k = 0; k < n; k++) {
                        if(k!=i&&k!=j){
                            int x = points[k][0];
                            int y = points[k][1];
                            if((x >= x1 && x <= x2) && (y <= y1 && y >= y2)){
                                flag = false;
                                break;
                            }
                        }
                    }
                    if(flag){
                        res++;
                    }
                }
            }
        }
        return res;
    }
}